<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>鑫立方管理系统</title>
<link rel="stylesheet" type="text/css" href="<%=basePath%>css/common.css" />
<link rel="stylesheet" type="text/css" href="<%=basePath%>css/main.css" />
<script type="text/javascript" src="<%=basePath%>js/libs/modernizr.min.js"></script>
<script type="text/javascript" src="<%=basePath%>js/jquery-1.10.2.min.js"></script>

</head>
<body>
  <div class="topbar-wrap white">
    <div class="topbar-inner clearfix">
      <div class="topbar-logo-wrap clearfix">
        <ul class="navbar-list clearfix">
          <li><a class="on" href="#">鑫立方管理系统</a></li>
        </ul>
      </div>
      <div class="top-info-wrap">
        <ul class="top-info-list clearfix">
          <li><a href="/user/logout">退出</a>
        </ul>
      </div>
    </div>
  </div>
  <div class="container clearfix">
    <div class="sidebar-wrap">
      <div class="sidebar-content">
        <ul class="sidebar-list">
          <li><a href="#"><i class="icon-font">&#xe003;</i>主材部</a>
            <ul class="sub-menu">
             <li><a href="<%=basePath + "product/index"%>"><i class="icon-font">&#xe008;</i>商品管理</a>
              </li>
              <li><a href="<%=basePath + "factory/product"%>"><i class="icon-font">&#xe006;</i>厂家管理</a>
              </li>
              <li><a href="<%=basePath + "order/index"%>"><i class="icon-font">&#xe005;</i>订单管理</a>
              </li>
              <c:if test="${sessionScope.xlf_userType == '10' }">
              <li><a href="<%=basePath + "user/index"%>"><i class="icon-font">&#xe009;</i>管理员管理</a>
              </li>
              </c:if>
              <li><a href="<%=basePath + "product/mail"%>"><i class="icon-font">&#xe004;</i>邮件配置</a>
              </li>
               <li><a href="<%=basePath + "email/index"%>"><i class="icon-font">&#xe012;</i>邮件记录</a>
              </li>
            </ul></li>
        </ul>
      </div>
    </div>
    <!--/sidebar-->
    <div class="main-wrap">
      <div class="crumb-wrap">
        <div class="crumb-list">
          <i class="icon-font"></i><a href="/product/index">首页</a><span class="crumb-step">&gt;</span><span class="crumb-name">管理员管理</span>
        </div>
      </div>
      <div class="search-wrap">
        <div class="search-content">
          <form action="/user/index" method="post">
            <table class="search-tab">
              <tr>
                <th width="90">管理员名称:</th>
                <td><input class="common-text" name="name" value="${name }" type="text">
                </td>
                <th width="120">角色类型:</th>
                <td>
                  <select name="roleType">
                    <option value="-1">全部</option>
                    <c:forEach items="${roleList }" var="option" varStatus="s">
                      <c:if test="${roleType == option.id }">
                        <option value="${option.id }" selected="selected">${option.name }</option>
                      </c:if>
                      <c:if test="${roleType != option.id }">
                        <option value="${option.id }">${option.name }</option>
                      </c:if>
                    </c:forEach>
                  </select>
                </td>
                <td><input class="btn btn-primary btn2" name="sub" value="查询" type="submit" onclick=""></td>
              </tr>
            </table>
          </form>
        </div>
      </div>
      <div class="result-wrap">
      
       <div class="result-title">
          <div class="result-list">
             <font color="#FF5809">${notice }</font>
          </div>
          <div class="result-list">
            <a href="/user/addNew"><i class="icon-font">&#xe026;</i>添加管理员</a>
          </div>
        </div>
        <form name="myform" id="myform" method="post">
          <div class="result-content">
            <table class="result-tab" width="100%">
              <tr>
                <th width="3%">No.</th>
                <th>管理员姓名</th>
                <th>登陆账号</th>
                <th>联系电话</th>
                <th>管理员类型</th>
                <th>状态</th>
                <th>操作</th>
              </tr>
              <jsp:useBean id="role" class="com.xlf.cache.RoleList"></jsp:useBean>
              <c:forEach items="${pageRecord.list }" var="u" varStatus="s">
                <tr>
                  <td>${s.index + 1}</td>
                  <td>${u.name}</td>
                  <td>${u.username}</td>
                  <td>${u.tel}</td>
                  <td>${role.getName(u.type) }</td>
                  <td>
                    <c:if test="${u.status == 0 }"><span style="color:red">停用</span></c:if>
                    <c:if test="${u.status == 1 }">正常</c:if>
                  </td>
                  <td>
                    <a href="/user/form?id=${u.u_id }"><i class="icon-font">&#xe002;</i>编辑</a>&nbsp;&nbsp;
                    <a href="/user/hold?id=${u.u_id }" onClick="return confirm('确定停用此账号?');"><i class="icon-font">&#xe020;</i>停用</a>&nbsp;&nbsp;
                    <a href="/user/recover?id=${u.u_id }" onClick="return confirm('确定恢复此账号?');"><i class="icon-font">&#xe005;</i>恢复</a>
                  </td>
                </tr>
              </c:forEach>
            </table>

            <div class="list-page">
              <span> 共 ${pageRecord.totalRow } 条 ${pageRecord.pageNumber }/${pageRecord.totalPage } 页 </span>
              <fmt:parseNumber var="totalPageNumber" value="${pageRecord.totalPage }" type="number"></fmt:parseNumber>
              <span style="float:right"> 
                <c:if test="${pageRecord.totalPage > 10 }">
                  <c:set var="totalPageNumber" value="10"></c:set>
                </c:if> <c:if test="${pageRecord.totalPage <= 10 }">
                  <c:set var="totalPageNumber" value="${pageRecord.totalPage }"></c:set>
                </c:if> 
                <c:forEach var="item" varStatus="vs" begin="1" end="${totalPageNumber }">
                    <a href="index?roleType=${roleType }&page=${vs.index }">${vs.index }</a>
                </c:forEach>
              </span>
            </div>
          </div>
        </form>
      </div>
    </div>
    <!--/main-->
  </div>
</body>
</html>
